# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=atear
pkgver=139.245ec8d
pkgrel=5
pkgdesc='Wireless Hacking, WiFi Security, Vulnerability Analyzer, Pentestration.'
groups=('blackarch' 'blackarch-wireless' 'blackarch-recon' 'blackarch-scanner')
arch=('any')
url='https://github.com/NORMA-Inc/AtEar'
license=('Apache')
depends=('nmap' 'wireshark-cli' 'aircrack-ng' 'hostapd' 'python2-scapy' 'python2'
         'python2-requests' 'python2-flask' 'python2-paramiko'
         'python2-smartencoding' 'python2-python-libnmap' 'python2-psycopg2'
         'python2-pyodbc')
makedepends=('git')
source=("$pkgname::git+https://github.com/NORMA-Inc/AtEar.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 run.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

